package org.crazyrunner.module.sys.controller;


import javax.annotation.Resource;

import org.crazyrunner.module.sys.entity.Menu;
import org.crazyrunner.module.sys.service.MenuService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("menu")
public class MenuController {
	
	@Resource
	private MenuService menuService;
	
	@RequestMapping("save")
	public String save(Menu menu,Model model){
		menuService.save(menu);
		return "menu/page";
	}
	
	@RequestMapping("deleteAll")
	public String deleteAll(){
		menuService.deleteAll();
		return "menu/page";
	}
	
	@RequestMapping("menuList")
	public String menuList(String menuId,Model model){
		Menu menu = menuService.getMenu(menuId);
		model.addAttribute("menu", menu);
		return "menu/menuList";
	}
}
